package com.example.demo.thread.singleton;

/**
 * @Description: 懒汉模式基础上加Synchronized
 * @Author: LLL
 * @Date: 2020-03-19 15:30
 **/
public class LazySingletonV2 {

    private LazySingletonV2() {
    }

    private static LazySingletonV2 instance = null;

    public static synchronized LazySingletonV2 getInstance() {
        if (instance == null) {
            instance = new LazySingletonV2();
        }
        return instance;
    }
}
